--- title: Mapping Voteshare Margin author: R package build date: '2022-09-12' slug: [] categories: [] tags: [] summary: "From now until November 3, I will be updating this weekly blog series with my **2022 US midterm election prediction model**. In this first blog, I'll be comparing the voteshare margin by party to the seat share by party in each state to hopefully explore the effects of gerrymandering." ---
This blog is part of a series related to Gov 1347: Election Analytics, a course at Harvard University taught by Professor Ryan D. Enos.
From now until November 3, I will be updating this weekly blog series with my 2022 US midterm election prediction model. In this first blog, I’ll be comparing the vote share margin by party to the seat share by party in each state to hopefully explore the effects of gerrymandering.
Gerrymandering, or the act of manipulating the boundaries of an electoral constituency in order to give one party an advantage, can be likened to a legal way of stealing an election. By analyzing the voters in a state, politicians can change the boundaries of the state’s congressional districts in order to achieve a favored outcome. For example, if there is a group of strong democrats all located in a similar geographic region, politicians can gerrymander by drawing district boundaries in such a way that splits up this democratic center and groups them with a stronger Republican area – even if the district lines make no logical sense – so that the seat ends up going to a Republican candidate.
In states with these arguably unfair districts, the share of House seats that end up with each party may very likely differ from what the results of a popular vote would predict. Gerrymandering is anti-democratic in that it diminishes voter power by creating outcomes that are not aligned with voter preferences. While redistricting itself is important to the democratic process and representing voters, when the power of redistricting is left to politicians they can essentially pick and choose their voters.
Every 10 years when Census numbers are released, the districts are redrawn. This took place in 2011, following the 2010 midterm election when President Obama led the Democratic Party in the White House. Republicans worked to redistrict the map in a way that would give them more power in the following elections. In order to assess whether their gerrymandering efforts were successful, I have analyzed both vote share margin by party and seat share by party across the country to see how the two compare. I chose to look specifically at 2010 and 2012, since the 2010 election used the old districts and the 2012 election was the first election with the new districts. In a state where gerrymandering was used, we would expect to see a party’s seat share be greater than the vote share margin; where the popular vote percentage does not translate into House seats.
Below are two maps plotting the GOP vote share margin in 2010 and 2012.
## make map of GOP vote share by state (national) - 2010
# use h dataset from earlier
# filter for relevant variables
h <- read_csv("house party vote share by district 1948-2020.csv")
## Rows: 16067 Columns: 31
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (16): Office, State, Area, RepCandidate, RepStatus, DemCandidate, DemSta...
## dbl (14): raceYear, RepVotes, DemVotes, ThirdVotes, OtherVotes, PluralityVot...
## lgl (1): CensusPop
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
R_2010 <- h %>%
filter(raceYear == 2010) %>%
select(raceYear, State, district_num, district_id, RepVotes, DemVotes) %>%
# summarize party vote share by state
group_by(State) %>%
# mutate Rep vote margin by state %>%
mutate(R_votemargin_st = (sum(RepVotes))/sum(RepVotes + DemVotes),
D_votemargin_st = (sum(DemVotes))/sum(RepVotes + DemVotes)) %>%
rename(state = State) %>%
mutate_at(vars(R_votemargin_st, D_votemargin_st), ~ round(., 4))
# repeat for 2012 (after redistricting)
R_2012 <- h %>%
filter(raceYear == 2012) %>%
select(raceYear, State, district_num, district_id, RepVotes, DemVotes) %>%
# summarize party vote share by state
group_by(State) %>%
# mutate Rep vote margin by state %>%
mutate(R_votemargin_st = (sum(RepVotes))/sum(RepVotes + DemVotes),
D_votemargin_st = (sum(DemVotes))/sum(RepVotes + DemVotes)) %>%
rename(state = State) %>%
mutate_at(vars(R_votemargin_st, D_votemargin_st), ~ round(., 4))
# load usmap
# install.packages('plot_usmap')
states_map <- usmap::us_map()
unique(states_map$abbr)
## [1] "AL" "AK" "AZ" "AR" "CA" "CO" "CT" "DE" "DC" "FL" "GA" "HI" "ID" "IL" "IN"
## [16] "IA" "KS" "KY" "LA" "ME" "MD" "MA" "MI" "MN" "MS" "MO" "MT" "NE" "NV" "NH"
## [31] "NJ" "NM" "NY" "NC" "ND" "OH" "OK" "OR" "PA" "RI" "SC" "SD" "TN" "TX" "UT"
## [46] "VT" "VA" "WA" "WV" "WI" "WY"
# plot 2010
vm2010 <- plot_usmap(data = R_2010, regions = "states", values = "R_votemargin_st") +
scale_fill_gradient(low = "white", high = "firebrick", name = "Voteshare Margin") +
theme_void()
# plot 2012
vm2012 <- plot_usmap(data = R_2012, regions = "states", values = "R_votemargin_st") +
scale_fill_gradient(low = "white", high = "firebrick", name = "Voteshare Margin") +
theme_void()
# make interactive
ggplotly(vm2010) %>%
layout(xaxis = list(showline = FALSE),
yaxis = list(showline = FALSE),
title = "GOP Two-Party Vote Share Margin 2010")
ggplotly(vm2012) %>%
layout(xaxis = list(showline = FALSE),
yaxis = list(showline = FALSE),
title = "GOP Two-Party Vote Share Margin 2012")
One of the main takeaways from comparing these two maps is that the GOP vote share margin in the Midwest and South decreases. The map in these areas goes from the darker shades of red to a lighter shade, suggesting that Republicans in these states are receiving less support.
Below are two maps plotting the GOP seat share in 2010 and 2012.
# making a map of GOP seat share by state (national) - 2010 to 2014
# load data from the 2010, 2012, and 2014 elections
seats_years <- read_csv("export copy.csv",
skip = 2)
## Warning: One or more parsing issues, see `problems()` for details
## Rows: 176 Columns: 14
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (14): Office, RaceDate, CensusPop, Area, RepWinner, DemWinner, OtherWinn...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# eliminating NAs and delimiters
seats_years <- subset(seats_years, seats_years$RaceDate == 20101102 | seats_years$RaceDate == 20121106)
# cleaning the data
seats_years <- seats_years %>%
group_by(RaceDate) %>%
mutate(RepWinner = as.numeric(RepWinner),
DemWinner = as.numeric(DemWinner),
OtherWinner = as.numeric(OtherWinner),
TotalSeats = RepWinner + DemWinner + OtherWinner,
RepSeatShare = (RepWinner/TotalSeats),
DemSeatShare = (DemWinner/TotalSeats)) %>%
# summarize party seat share by state
group_by(Area) %>%
rename(state = Area) %>%
mutate_at(vars(RepSeatShare, DemSeatShare), ~ round(., 4))
# new dfs for each year
seat10 <- seats_years %>%
filter(RaceDate == 20101102)
seat12 <- seats_years %>%
filter(RaceDate == 20121106)
# load usmap
states_map <- usmap::us_map()
unique(states_map$abbr)
## [1] "AL" "AK" "AZ" "AR" "CA" "CO" "CT" "DE" "DC" "FL" "GA" "HI" "ID" "IL" "IN"
## [16] "IA" "KS" "KY" "LA" "ME" "MD" "MA" "MI" "MN" "MS" "MO" "MT" "NE" "NV" "NH"
## [31] "NJ" "NM" "NY" "NC" "ND" "OH" "OK" "OR" "PA" "RI" "SC" "SD" "TN" "TX" "UT"
## [46] "VT" "VA" "WA" "WV" "WI" "WY"
# plot 2010 republican
ss10_r <- plot_usmap(data = seat10, regions = "states", values = "RepSeatShare") +
scale_fill_gradient(low = "white", high = "firebrick", name = "GOP Seat Share") +
theme_void()
# plot 2010 democrate
ss10_d <- plot_usmap(data = seat10, regions = "states", values = "DemSeatShare") +
scale_fill_gradient(low = "white", high = "dodgerblue4", name = "Democratic Seat Share") +
theme_void()
# plot 2012 republican
ss12_r <- plot_usmap(data = seat12, regions = "states", values = "RepSeatShare") +
scale_fill_gradient(low = "white", high = "firebrick", name = "GOP Seat Share") +
theme_void()
# plot 2012 democrat
ss12_d <- plot_usmap(data = seat12, regions = "states", values = "DemSeatShare") +
scale_fill_gradient(low = "white", high = "dodgerblue4", name = "Democratic Seat Share") +
theme_void()
# add plotly to make interactive
ggplotly(ss10_r) %>%
layout(xaxis = list(showline = FALSE),
yaxis = list(showline = FALSE),
title = "GOP House of Representatives Seat Share - 2010")
ggplotly(ss12_r) %>%
layout(xaxis = list(showline = FALSE),
yaxis = list(showline = FALSE),
title = "GOP House of Representatives Seat Share - 2012")
Looking at these two maps side by side, we see what looks like an increase in GOP seat share in the mid-Atlantic. In comparing the two maps from 2010 side by side, we can see that while the GOP vote share margin map does not look particularly red, the GOP seat share map is much darker. This shows us that despite Republicans not receiving an overwhelming number of votes in the 2010 election, they were still able to capture a large number of House seats. Looking at the data more quantitatively, we find that Republicans in 2010 won an additional 63 seats in the House, giving them a total of 242, and won the popular vote by 6.8%. These were the results before the redistricting.
Now looking at the two maps from 2012, we see essentially the same pattern: the map of vote share margin for Republicans is not overwhelmingly red, while the seat share map is heavily red, specifically in the Midwest and Mid-Atlantic regions. In this election – the first since the new districts – Republicans actually ended up losing 7 seats, bringing them down to 233. While my initial expectations from gerrymandering would have led me to predict Republicans would win even more seats, I will also acknowledge that I am not very familiar with the political mood at the time. Were Republicans expected to lose even more seats had they not redistricted?
After the 2020 Census report, again politicians were brought in to fix the maps and redistrict. The results of the most recent redistricting will be revealed in this upcoming 2022 election, and will impact the outcomes of elections for the next 10 years. The people in charge of creating these districts need checks and balances in place to ensure that democracy persists and the maps are representative of the voters.